<template>
  <div id="OrdersTitle"
       ref="index">
    <v-tableTitle :btnConfig="btnConfig"
                  :tableSelectData="tableSelectData"
                  :title="$t('ex.addtask')"
                  @newCreate="newCreate"></v-tableTitle>
    <v-details :inputConfig="inputConfig"
               :detailData="inputData"
               :rules="rules"
               ref="input"></v-details>
  </div>
</template>

<script>
import details from "@/components/commons/Detail";
import baseMixin from "@/mixins/BaseMixin";
import tableTitle from "@/components/commons/TableTitle";

export default {
  props: {},
  mixins: [baseMixin],
  name: "bhrwscQuery",
  data () {
    return {
      addflag: false,
      inputData: {
        rptype: "2",
        strategycode: "",
        storerkeyfrom: "0",
        storerkeyto: "ZZZZZZZZZZZZZZZZZZZ",
        skufrom: "0",
        skuto: "ZZZZZZZZZZZZZZZZZZZ",
      },
      tableSelectData: [],
    };
  },

  computed: {
    btnConfig () {
      return [{ label: this.$t('ex.createtask'), certigier: !this.btnPermNameList.includes('WM06030201'), invalid: "newCreate" }];
    },
    inputConfig () {
      return [
        [
          {
            type: "select",
            label: this.$t('ex.strategytype'),
            props: "rptype",
            options: this.getOptions("codelkup/RTXSTRATEGYTYPE"),
          },
          {
            type: "input",
            label: this.$t('ex.storerkeyfrom'),
            props: "storerkeyfrom",
          },
          {
            type: "input",
            label: this.$t('ex.skufrom'),
            props: "skufrom",
          },
        ],
        [
          {
            type: "select",
            label: this.$t('ex.strategycode1'),
            props: "strategycode",
            options: this.getOptions(
              `queryrpstrategylistCopy/${this.inputData.rptype}`
            ),
          },
          {
            type: "input",
            label: this.$t('ex.storerkeyto'),
            props: "storerkeyto",
          },

          {
            type: "input",
            label: this.$t('ex.skuto'),
            props: "skuto",
          },
        ],
      ];
    },
    rules () {
      return {};
    },
  },
  methods: {
    screen () {
      this.$refs.index.style.width = "100%";
      this.$refs.index.style.height = "100%";
      this.$refs.index.style.position = "fixed";
      this.$refs.index.style.top = "0";
      this.$refs.index.style.left = "0";
      this.$refs.index.style.zIndex = "10";
      this.$refs.index.style.background = "#fff";
    },
    newCreate () {
      let params = JSON.parse(JSON.stringify(this.inputData));
      // if (this.inputData.rptype == "2") {
      //   params.rptype = "WAVE";
      // } else {
      //   params.rptype = "LOC";
      // }
      this.$api.post(`/replnewcreatetask`, params).then((res) => {
        
          this.$message.success(res.returnMgr);
         /*  this.inputData = {
            rptype: "2",
            strategycode: "",
            storerkeyfrom: "0",
            storerkeyto: "ZZZZZZZZZZZZZZZZZZZ",
            skufrom: "0",
            skuto: "ZZZZZZZZZZZZZZZZZZZ",
          } */
        
      });
    },
  },
  mounted () {
    if (this.$route.params.type == "bhJump") {
      this.screen();
    }
  },
  watch: {},
  components: {
    "v-details": details,
    "v-tableTitle": tableTitle,
  },
};
</script>

<style scoped>
</style>
